
local function getPath(uri)
    local filepath = '';
    local pos;
    while(true)do
        local ps,pe,prefix,c = uri:find('([^%%]+)%%(.?.?)',pos)
        if(ps==nil)then
            ps,pe,prefix = uri:find('(.*)',pos)
            filepath = filepath .. prefix;
            break;
        end
        if(c:sub(1,1)=='%')then
            filepath = filepath .. prefix .. '%';
            pos = pe + 1;
        else
            filepath = filepath .. prefix .. string.char( tonumber('0x'..c));
            pos = pe + 1;
        end
    end
    local ps,pe,path = filepath:find('file:/*(.+)');
    return path;
end
pathMapping = {};
function UriToPath(path)
    if(pathMapping[path])then
        return pathMapping[path];
    end
    local path = getPath(path);
    if(path)then
        pathMapping[path] = path;
    end
    return path;
end
local sys = os.getenv('OS');
function FindFiles(path)
    --可能需要把path转换一下
    local list = {};
    if(sys==nil or sys:find('Windows'))then
        local f = io.popen('dir /a/s/b "'..path..'"');
        for l in f:lines() do
            table.insert(list,l);
        end
    else
        local f = io.popen('find "'..path..'"');
        for l in f:lines() do
            table.insert(list,l);
        end
    end
    return list;
end
